#    Tichy
#
#    copyright 2008 Guillaume Chereau (charlie137@gmail.com)
#
#    This file is part of Tichy.
#
#    Tichy is free software: you can redistribute it and/or modify it
#    under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Tichy is distributed in the hope that it will be useful, but
#    WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#    General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Tichy.  If not, see <http://www.gnu.org/licenses/>.


from geo import Vect, Rect, asvect, asrect
from widget import Widget
from label import Label
from button import Button


class Painter(object):
    """This class is used to draw all the widgets

    The idea is to subclass it when we want special drawing style.

    """

    def __init__(self, pos=None, mask=None):
        self.pos = pos or Vect(0, 0)
        self.mask = mask

    def set_mask(self, rect):
        self.mask = Rect(rect[0], rect[1])

    def move(self, v):
        self.pos = self.pos + v
        self.mask = self.mask.move(-v)

    def umove(self, v):
        self.move(-v)

    def clip(self, r):
        self.mask = self.mask.clip(r)

    def to_surface(self, surface):
        """Return a engine similar to this one but drawing into a given
        surface
        """
        raise NotImplementedError

    def surface_from_size(self, size):
        """Create a new surface"""
        raise NotImplementedError

    def surface_from_image(self, path):
        """Create a new surface"""
        raise NotImplementedError

    def draw_surface(self, surf, area=None):
        raise NotImplementedError

    def fill(self, color, size=None):
        raise NotImplementedError

    def draw_frame(self, frame, size):
        raise NotImplementedError

    def flip(self, rect=None):
        raise NotImplementedError
